<template>
  <div class="box">
    <van-list
      v-model="loading"
      :finished="finished"
      :immediate-check="false"
      finished-text="我是有底线的~"
      @load="onLoad"
    >
    
  <div>
        <router-link :to="{path:'/topic/topicDetail',query:{id:item.id}}"  v-for="item in list" :key="item.id">
          <img :src="item.scene_pic_url" alt="" />
          <p class="title">{{ item.title }}</p>
          <p class="subtitle">{{ item.subtitle }}</p>
          <p class="price">￥{{ item.price_info }}起</p>

     </router-link>
          </div>
    </van-list>
  </div>
</template>

<script>
import { listaction } from "@/api/topic";
export default {
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      pageId: 1,
    };
  },
  computed: {},
  created() {},
  mounted() {
    this.init();
  },
  methods: {
    //   下拉更新
    onLoad() {
    //   console.log(22);
      this.pageId++;
      this.init();
    },
    // 请求后台数据
    init() {
      listaction({
        page: this.pageId,
      }).then((res) => {
        console.log(res);
        // 拓展运算符获取数组中所有数据
        this.list.push(...res.data);
        this.loading = false;
        if (this.pageId >= res.total) {
          this.finished = true;
        }
      });
    },
  },
};
</script >

<style scoped lang="scss">
.box {
  width: 100%;
  background: #fff;
  margin-bottom: 50px;
  // text-align: center;
  img {
    width: 100%;
  }
  .title {
        color: #333;
    font-size: .46667rem;
    margin-top: 0.4rem;
  }
  .subtitle {
    color: #999;
    font-size: .32rem;
    margin-top: 0.21333rem;
    padding: 0 0.26667rem;
}
  
  .price {
    color: #b4282d;
    font-size: .36rem;
    margin-top: 0.26667rem;
}
  
}
</style>
